package leetCode.offer66;

public class Solution1 implements Solution{

    /**
     * 此解法超出时间限制
     * @param a
     * @return
     */
    @Override
    public int[] constructArr(int[] a) {
        if(a==null||a.length==0) return null;
        if(a.length==1) return a;
        int[] result = new int[a.length];

        for(int i=0;i<a.length;i++){
            int mul = 1;
            if(i>0) {
                mul = a[i-1];
                a[i] *= a[i-1];
            }
            for(int j=i+1; j<a.length; j++){
                mul *= a[j];
            }
            result[i] = mul;
        }

        return result;
    }

}
